<template>
  <div>
    <div class="sign">
      <!-- logo -->
      <div class="logo">
        <a href="/">
          <img src="./image/logo.png" />
        </a>
      </div>
      <!-- 卡片容器 -->
      <div class="signContainer">
        <!-- 下载 -->
        <div class="downloadContent">
          <a class="downloadBtn"> 下载简书APP</a>
          <!-- 二维码 -->
          <div class="downloadQrcode">
            <div class="downloadQrcodeicon"></div>
          </div>
        </div>
        <!-- 登录卡 -->
        <div class="main">
          <h4 class="title">
            <div class="normalTitle">
              <router-link to="/login" class="active">登录</router-link>
              <b>·</b>
              <router-link to="/register" class="">注册</router-link>
            </div>
          </h4>
          <!-- 账号密码 -->
          <div class="signinContainer">
            <form id="newSession" action="/login">
              <!-- 手机号邮箱 -->
              <div class="input-prepend inputPerpend">
                <input
                  type="text"
                  placeholder="手机号或邮箱"
                  v-model="userInfo"
                  autocomplete="“off”"
                />
                <i class="iconfont icon-shouji"></i>
              </div>
              <!-- 密码 -->
              <div class="input-prepend inputPerpend">
                <input
                  type="password"
                  placeholder="密码"
                  v-model="password"
                  autocomplete="“off”"
                />
                <i class="iconfont icon-yanzhengmamima"></i>
              </div>
              <!-- 选项 -->
              <div class="remember">
                <input type="checkbox" value="true" autocomplete="“off”" />
                <span>记住我</span>
              </div>
              <div class="forget">
                <a href>登录遇到问题？</a>
              </div>
              <!-- 登录按钮 -->
              <div class="signInbutton" @click="login()">
                <span>登录</span>
              </div>
            </form>
            <!-- 更多登陆方式 -->
            <div class="moreSign">
              <h6>——————&nbsp;&nbsp;&nbsp;&nbsp;社交账号登录&nbsp;&nbsp;&nbsp;&nbsp;——————</h6>
              <ul>
                <li>
                  <a class="weibo">
                    <i class="iconfont icon-shejiaotubiao-06"></i>
                  </a>
                </li>
                <li>
                  <a class="weixin">
                    <i class="iconfont icon-weixin"></i>
                  </a>
                </li>
                <li>
                  <a class="QQ">
                    <i class="iconfont icon-QQ"></i>
                  </a>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      userInfo: "13700000000",
      password: "111111",
    };
  },
  methods: {
    async login() {
      try {
        let { userInfo, password } = this;
        userInfo&&password&&(await this.$store.dispatch("userLogin", { phone: userInfo, password }));
        let toPath = this.$route.query.redirect || "/";
        this.$router.push(toPath);
        setTimeout(()=>{
        location.reload();
      },200)
      } catch (error) {}
    },
  },
};
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
a {
  text-decoration: none;
}

.sign {
  font-size: 14px;
  text-align: center;
  display: flex;
  /* align-content: center; */
  min-width: 900px;
  height: 100vh;
  background-color: #f1f1f1;
  position: relative;
}

.sign .logo {
  position: absolute;
  top: 56px;
  margin-left: 50px;
}

.sign .signContainer {
  width: 820px;
  height: 600px;
  margin: 200px auto 0;
  background-image: url(./image/sign_in.png);
  background-size: 40%;
  background-repeat: no-repeat;
  background-position: 45px 0;
  position: relative;
}

.signContainer .downloadContent {
  display: flex;
  align-items: center;
  position: absolute;
  left: 60px;
  top: 452px;
}

.downloadContent .downloadBtn {
  display: block;
  width: 252px;
  height: 46px;
  margin-right: 15px;
  background-color: #ea6f5a;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  line-height: 46px;
  cursor: pointer;
}

/*二维码样式 */
.signContainer .downloadQrcode {
  width: 46px;
  height: 46px;
  position: relative;
  border-radius: 5px;
  background-image: url("./image/erweima.png");
  background-size: 38px;
  background-repeat: no-repeat;
  background-color: #fff;
  background-position: 4px 4px;
  cursor: pointer;
}

.downloadQrcode .downloadQrcodeicon {
  width: 21px;
  height: 21px;
  position: absolute;
  display: none;
  background-color: #fff;
  transform: rotate(45deg);
  box-shadow: 0 0 15px 0 rgb(0 0 0 / 15%);
  bottom: 74px;
  right: 20px;
  z-index: 1;
}

/* 登录栏样式 */
.sign .main {
  float: right;
  width: 400px;
  margin: 0 auto;
  padding: 50px 50px 30px;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 0 8px rgb(0 0 0 / 10%);
  vertical-align: middle;
  display: inline-block;
}
.sign .title {
  font-size: 18px;
  margin: 0 auto 50px;
  padding: 10px;
  font-weight: 400;
  color: #969696;
}
.title .active {
  font-weight: 700;
  color: #ea6f5a;
  border-bottom: 2px solid #ea6f5a;
}
.sign .title a {
  padding: 10px;
  color: #969696;
  cursor: pointer;
}

.signinContainer form {
  display: block;
  margin: 0 0 20px;
}
.inputPerpend {
  position: relative;
  width: 100%;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.input-prepend input {
  width: 100%;
  height: 50px;
  margin-bottom: 0;
  padding: 4px 12px 4px 35px;
  border: 1px solid #c8c8c8;
  background-color: hsla(0, 0%, 71%, 0.1);
  vertical-align: middle;
}
.inputPerpend i {
  position: absolute;
  top: 14px;
  left: 10px;
  font-size: 18px;
  color: #969696;
}
.remember {
  float: left;
  margin: 15px 0;
}
.remember span {
  font-size: 15px;
  color: #969696;
}

.forget {
  float: right;
  position: relative;
  margin: 15px 0;
  font-size: 14px;
}
.forget a {
  color: #999;
}
.sign .signInbutton {
  background: #3194d0;
  margin-top: 20px;
  width: 100%;
  padding: 9px 18px;
  border: none;
  border-radius: 25px;
  color: #fff;
  cursor: pointer;
  outline: none;
  display: block;
  clear: both;
}

.moreSign {
  margin-top: 50px;

}
.moreSign h6 {
  position: relative;
  margin: 0 0 10px;
  font-size: 12px;
  color: #b5b5b5;
}
.moreSign ul {
  margin-bottom: 10px;
  list-style: none;
  padding-left: 0;
  display:flex;
  justify-content: center;
}
.moreSign .iconfont{
  font-size:32px;
  color:#e05244

}
.moreSign .icon-weixin{
  margin: 0 36px;
  color: #00bb29;
}
.moreSign .icon-QQ{
  color: #498ad5;
}
// .weibo .weibo {
//   color: #e05244;
//   font-size: 50px;
// }
</style>
